﻿<!--#Include File="../Inc/Const.Asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>插件配置</title>
<link href="Images/Style.Css" rel="stylesheet" type="text/css" />
</head>
<body>
<%
Call ChkLogin("setting")
Dim x,i,j,v

Dim JumpUrl
JumpUrl = "Admin_PlusSetting.Asp"

Dim PlusName
PlusName = Request("Name")

If Not ChkLevel("setting") Then
	If Not ChkManagePlus(PlusName) Then Response.WRite "无效的越权操作!" : Response.End
End If

If Len(PlusName) > 0 Then
	Dim Plus
	Set Plus = New Cls_Plus
	Call Plus.Open(PlusName)
	If Plus.ErrorCode = 0 Then
		x = Plus.ConfigLength ' 获取参数个数
		If Request("Act") = "UpDate" Then
			For j = 0 To x - 1
				v = Request("o" & Plus.ConfigItem(j,"name"))
				Select Case LCase(Plus.ConfigItem(j,"data"))
				Case "int"
					If Len(v) = 0 Or Not IsNumeric(v) Then v = 0
				Case "text"
					v = Replace(v,Vbcrlf,"")
				End Select
				Call Plus.ConfigSave(j,v)
			Next
			Response.Redirect "Admin_plus.Asp"
		Else
			Call Main_Guide()
		End If
	End If
End If
If IsObject(Conn) Then Conn.Close : Set Conn = Nothing

Sub Main_Guide()
	%>
<table width=100% border=0 cellpadding=3 cellspacing=1 class=css_table bgcolor='#E1E1E1'>
	<tr class=css_menu>
		<td colspan=2>
			<table width=100% border=0 cellpadding=4 cellspacing=0 class=css_main_table>
				<tr>
					<td class=css_main><a href=Admin_PlusSetting.Asp?Name=<%=PlusName%>><%=Plus.Main("name")%>配置</a> <font style="font-size: 13px;color: #666;letter-spacing: 0px;">作者：<%=Plus.Main("author")%> 网址：<a href='<%=Plus.Main("authorurl")%>' target='_blank'><%=Plus.Main("authorurl")%></a></font></td>
				</tr>
			</table>
		</td>
	</tr>
	<form name='frm' method='post' action='Admin_PlusSetting.Asp?Name=<%=PlusName%>&Act=UpDate'>
	<%
	Dim PTitle,PName,PValue,PValues,PDescription,PData,PForm
	Dim Rs,Tmp,Tv,Tn
	For j = 0 To x - 1
		PTitle       = Plus.ConfigItem(j,"title")
		PName        = Plus.ConfigItem(j,"name")
		PValue       = Plus.ConfigItem(j,"value")
		PDescription = Plus.ConfigItem(j,"description")
		PData        = Plus.ConfigItem(j,"data")
		PForm        = Plus.ConfigItem(j,"form")
		PValues      = Plus.ConfigItem(j,"values")
	%>
		<tr>
			<td class=css_col1<%=(j mod 2)+1%>><%=PTitle%>：
				<div id='h<%=PName%>' style="color:#ccc;letter-spacing: 0px;font-size:13px;"><%=PDescription%></div>
			</td>
			<td class=css_col2<%=(j mod 2)+1%>>
				<%
				Select Case LCase(PForm)
				Case "input"
				%>
				<input class='css_input' name="o<%=PName%>" type="text" id="o<%=PName%>" onfocus="h<%=PName%>.style.color='red';" onblur="h<%=PName%>.style.color='#ccc';" value="<%=Server.HtmlEnCode(PValue & "")%>" style="width:300px;" >
				<%
				Case "textarea"
				%>
				<textarea class='css_textarea' name="o<%=PName%>" type="text" id="o<%=PName%>" onfocus="h<%=PName%>.style.color='red';" onblur="h<%=PName%>.style.color='#ccc';" cols="50" rows="5" ><%=Server.HtmlEnCode(PValue & "")%></textarea>      </td>
				<%
				Case "select"
				%>
				<select class='css_select' name="o<%=PName%>" type="text" id="o<%=PName%>" onfocus="h<%=PName%>.style.color='red';" onblur="h<%=PName%>.style.color='#ccc';" style="width:150px;">
					<%
					If Len(PValues) > 0 Then
						Tmp = Split(PValues,"|||")
						For i= 0 To UBound(Tmp)
							If Instr(Tmp(i),"=>") > 0 Then
								Tv = Split(Tmp(i),"=>")(0) : Tn = Split(Tmp(i),"=>")(1)
							Else
								Tv = Tmp(i) : Tn = Tmp(i)
							End If
							Response.Write "<option value=""" & Tv & """"
							If LCase(Tv) = LCase(PValue) Then Response.Write " selected "
							Response.Write ">" & Tn & "</option>"
						Next
					End If
					%>
				</select>
				<%
				End Select
				%>
			</td>
		</tr>
	<%
	Next
	%>
		<tr class=css_page_list>
			<td colspan=2>
				<input type='submit' name='Submit' value='保存'>
			</td>
		</tr>
	</form>
</table>
<%
End Sub
%>
</body>
</html>
